;; -*- lexical-binding: t -*-

(setq gc-cons-threshold (* 200 1024 1024))

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(TeX-DVI-via-PDFTeX t)
 '(TeX-PDF-mode t)
 '(TeX-electric-math '("$" . "$"))
 '(TeX-engine 'xetex)
 '(TeX-queue-command nil)
 '(ac-auto-show-menu 0.1)
 '(ac-auto-start 1)
 '(ansi-color-names-vector
   ["#1b1d1e" "#d02b61" "#60aa00" "#d08928" "#6c9ef8" "#b77fdb" "#00aa80" "#DFDFDF"])
 '(async-shell-command-buffer 'new-buffer)
 '(async-shell-command-display-buffer nil)
 '(bidi-paragraph-direction 'left-to-right)
 '(c-echo-syntactic-information-p t)
 '(calendar-latitude 36.80983445)
 '(calendar-longitude 117.99934387)
 '(column-number-mode t)
 '(custom-safe-themes
   '("8aca557e9a17174d8f847fb02870cb2bb67f3b6e808e46c0e54a44e3e18e1020" "7e78a1030293619094ea6ae80a7579a562068087080e01c2b8b503b27900165c" "6a37be365d1d95fad2f4d185e51928c789ef7a4ccf17e7ca13ad63a8bf5b922f" "ff82ac6718ad6c69ddbd28f32c3544e8462c7c3d97afbe1a0c4a0773e48a96e2" default))
 '(delete-selection-mode t)
 '(describe-char-unidata-list
   '(name old-name general-category canonical-combining-class decomposition decimal-digit-value digit-value numeric-value mirrored iso-10646-comment uppercase lowercase titlecase))
 '(dired-recursive-deletes 'always)
 '(dired-sort-menu-saved-config
   '((dired-actual-switches . "-alS")
     (ls-lisp-ignore-case)
     (ls-lisp-dirs-first)))
 '(dired-use-ls-dired t)
 '(disaster-cc "gcc")
 '(disaster-cflags "-Ofast -march=native -g3 -std=c11")
 '(disaster-cxxflags "-Ofast -march=native -g3 -std=c++1y")
 '(disaster-objdump "objdump -d -M intel-mnemonic -Sl --no-show-raw-insn")
 '(display-buffer-alist '(("*shell*" display-buffer-same-window)))
 '(display-time-24hr-format t)
 '(display-time-mode t)
 '(doc-view-continuous t)
 '(doc-view-resolution 192)
 '(echo-keystrokes 0.1)
 '(ediff-custom-diff-options "-u")
 '(ediff-window-setup-function 'ediff-setup-windows-plain)
 '(electric-pair-mode t)
 '(epg-gpg-program "/usr/bin/gpg")
 '(ess-eval-visibly 'nowait)
 '(fci-rule-color "#505050")
 '(font-lock-maximum-decoration t)
 '(gcmh-verbose t)
 '(gdb-many-windows t)
 '(gdb-show-main t)
 '(global-hl-line-mode t)
 '(global-prettify-symbols-mode t)
 '(global-semantic-decoration-mode t)
 '(global-semantic-highlight-func-mode t)
 '(global-semantic-idle-local-symbol-highlight-mode t nil (semantic/idle))
 '(global-semantic-idle-scheduler-mode t)
 '(global-semantic-idle-summary-mode t)
 '(global-semantic-show-parser-state-mode t)
 '(global-semantic-stickyfunc-mode nil)
 '(global-semanticdb-minor-mode t)
 '(gnuplot-process-name "pgnuplot")
 '(gnuplot-program "pgnuplot")
 '(google-translate-default-source-language "en")
 '(google-translate-default-target-language "zh-CN")
 '(grep-use-null-filename-separator t)
 '(help-at-pt-timer-delay 0.1)
 '(highlight-current-line-globally t)
 '(hscroll-margin 0)
 '(inhibit-startup-screen t)
 '(ispell-dictionary "en_US-large")
 '(ispell-local-dictionary-alist
   '(("en_US-large" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
      ("-d" "en_US-large,en_US-med,en_US-chem")
      nil utf-8)))
 '(ispell-program-name "c:/msys64/mingw64/bin/hunspell.exe" t)
 '(jdee-db-active-breakpoint-face-colors (cons "#1b1d1e" "#fc20bb"))
 '(jdee-db-requested-breakpoint-face-colors (cons "#1b1d1e" "#60aa00"))
 '(jdee-db-spec-breakpoint-face-colors (cons "#1b1d1e" "#505050"))
 '(js-indent-level 2)
 '(js2-basic-offset 2)
 '(js3-indent-level 2)
 '(js3-indent-tabs-mode t)
 '(langtool-default-language "en-US")
 '(langtool-mother-tongue "zh-CN")
 '(list-directory-verbose-switches "-l")
 '(load-prefer-newer t)
 '(magit-last-seen-setup-instructions "1.4.0" t)
 '(magit-repo-dirs '("~/repo"))
 '(make-backup-files nil)
 '(markdown-enable-math t)
 '(message-log-max 5000)
 '(minibuffer-prompt-properties
   '(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt))
 '(mouse-scroll-delay 0.15)
 '(no-redraw-on-reenter t)
 '(org-export-copy-to-kill-ring nil)
 '(org-export-html-footnote-format "<sup>[%s]</sup>")
 '(org-export-show-temporary-export-buffer nil)
 '(org-export-with-footnotes t)
 '(org-footnote-section "Footnotes:")
 '(org-footnote-tag-for-non-org-mode-files nil)
 '(org-html-doctype "html5")
 '(org-support-shift-select t)
 '(overline-margin 0)
 '(package-archives
   '(("gnu" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
     ("org" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/org/")
     ("melpa" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")
     ("marmalade" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/marmalade/")
     ("emacswiki" . "https://mirrors.tuna.tsinghua.edu.cn/elpa/emacswiki/")))
 '(package-enable-at-startup nil)
 '(package-gnupghome-dir "/home/Kel/.emacs.d/elpa/gnupg")
 '(package-selected-packages
   '(gcmh fast-scroll all-the-icons lv memoize svg transient treepy svg-clock gnu-elpa-keyring-update magit math-symbol-lists mutt-mode wordnut w32browser-dlgopen markdown-mode dna-mode systemd pacfiles-mode google-translate ghub ht w32-browser zone-matrix dired+ dired-sort-menu dired-sort-menu+ synonyms academic-phrases smiles-mode oauth2 auctex shimbun apel flim semi wanderlust async company dash git-commit magit-popup php-mode pdf-tools tablist load-relative test-simple with-editor symon mew cygwin-mount realgud hexo ess pandoc-mode nyan-mode pos-tip hydra linum-relative visual-fill-column writegood-mode auto-complete auto-complete-pcmp js2-mode julia-mode log4e multiple-cursors org packed popup powerline s simple-httpd skewer-mode yasnippet yaxception auto-compile rainbow-delimiters srefactor yaoddmuse yaml-mode vlf smart-compile rainbow-mode nlinum loc-changes js2-refactor js-comint htmlize gnuplot-mode fic-mode fasm-mode dot-mode disaster dired-k csv-mode auto-complete-auctex alpha ac-octave ac-math ac-js2 ac-etags ac-dabbrev ac-c-headers))
 '(pdf-annot-default-annotation-properties
   '((t
      (label . ""))
     (text
      (color . "#ff0000")
      (icon . "Insert"))
     (highlight
      (color . "yellow"))
     (underline
      (color . "blue"))
     (squiggly
      (color . "orange"))
     (strike-out
      (color . "red"))))
 '(pdf-view-midnight-colors '("gray94" . "black"))
 '(preview-TeX-style-dir "" t)
 '(preview-auto-cache-preamble t)
 '(preview-default-document-pt 25.0)
 '(preview-fast-conversion nil)
 '(preview-gs-options
   '("-q" "-dNOPAUSE" "-DNOPLATFONTS" "-dPrinted" "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4"))
 '(preview-scale-function 'preview-scale-from-face)
 '(ps-font-size '(9 . 10.5))
 '(ps-lpr-switches
   '("-q" "-dNOPAUSE" "-dBATCH" "-sDEVICE=mswinpr2" "-sPAPERSIZE=a4") t)
 '(ps-print-header nil)
 '(ps-printer-name t t)
 '(recentf-max-saved-items 200)
 '(recentf-mode t)
 '(safe-local-variable-values
   '((shell-file-name . "/bin/bash")
     (explicit-bash-args "-himBH")
     (explicit-shell-file-name . "/usr/pkg/bin/bash")
     (explicit-bash-args "-i")
     (explicit-shell-file-name . "/bin/bash")))
 '(search-whitespace-regexp "[-_ 
	]+")
 '(semantic-decoration-styles
   '(("semantic-decoration-on-includes" . t)
     ("semantic-decoration-on-protected-members")
     ("semantic-decoration-on-private-members")
     ("semantic-tag-boundary" . t)))
 '(semantic-default-submodes
   '(global-semantic-decoration-mode global-semantic-idle-scheduler-mode global-semanticdb-minor-mode global-semantic-idle-summary-mode))
 '(semantic-idle-work-update-headers-flag t)
 '(send-mail-function 'smtpmail-send-it)
 '(sh-basic-offset 8)
 '(sh-indentation 8)
 '(show-paren-mode t)
 '(shr-color-visible-luminance-min 95)
 '(size-indication-mode t)
 '(smart-compile-alist
   '((emacs-lisp-mode emacs-lisp-byte-compile)
     (html-mode browse-url-of-buffer)
     (nxhtml-mode browse-url-of-buffer)
     (html-helper-mode browse-url-of-buffer)
     (octave-mode run-octave)
     ("\\.c\\'" . "gcc -Wall -fopt-info -Ofast -march=native -std=c11 %f -lm -o %n")
     ("\\.[Cc]+[Pp]*\\'" . "g++ -Wall -fopt-info -Ofast -march=native -std=c++11 %f -lm -o %n")
     ("\\.java\\'" . "javac %f")
     ("\\.php\\'" . "php -l %f")
     ("\\.f90\\'" . "gfortran %f -o %n")
     ("\\.[Ff]\\'" . "gfortran %f -o %n")
     ("\\.cron\\(tab\\)?\\'" . "crontab %f")
     ("\\.tex\\'" tex-file)
     ("\\.texi\\'" . "makeinfo %f")
     ("\\.\\(md\\|markdown\\)\\'" . "make -f ~/repo/Makefile %n.docx")
     (text-mode . "pandoc %f -f markdown -o %n.docx -s")
     ("\\.mp\\'" . "mptopdf %f")
     ("\\.pl\\'" . "perl -cw %f")
     ("\\.rb\\'" . "ruby -cw %f")))
 '(socks-server '("Default server" "127.0.0.1" 65500 5))
 '(synonyms-cache-file "~/.emacs.d/mthesaur.txt.cache")
 '(synonyms-file "~/.emacs.d/mthesaur.txt")
 '(tab-always-indent nil)
 '(text-scale-mode-step 1.04)
 '(timer-max-repeats 1)
 '(tool-bar-mode nil)
 '(tooltip-delay 1.5)
 '(tooltip-hide-delay 60)
 '(tooltip-short-delay 0.7)
 '(tramp-completion-reread-directory-timeout nil)
 '(tramp-default-host "KAEL")
 '(tramp-default-method "scpx")
 '(tramp-local-host-regexp "\\`\\(127\\.0\\.0\\.1\\|::1\\|KAEL\\|localhost6?\\)\\'")
 '(uniquify-buffer-name-style 'forward nil (uniquify))
 '(vc-annotate-background "#1b1d1e")
 '(vc-annotate-color-map
   (list
    (cons 20 "#60aa00")
    (cons 40 "#859f0d")
    (cons 60 "#aa931a")
    (cons 80 "#d08928")
    (cons 100 "#d38732")
    (cons 120 "#d6863d")
    (cons 140 "#da8548")
    (cons 160 "#ce8379")
    (cons 180 "#c281aa")
    (cons 200 "#b77fdb")
    (cons 220 "#bf63b2")
    (cons 240 "#c74789")
    (cons 260 "#d02b61")
    (cons 280 "#b0345c")
    (cons 300 "#903d58")
    (cons 320 "#704654")
    (cons 340 "#505050")
    (cons 360 "#505050")))
 '(vc-annotate-very-old-color nil)
 '(visible-bell t)
 '(vlfi-batch-size 1048576)
 '(wl-quicksearch-folder "%INBOX:chriszheng99/clear@127.0.0.1:993!")
 '(zmx-unicode-mode nil))

(unless (daemonp)
  (server-start))

;; (set-language-environment "UTF-8")
;; (prefer-coding-system 'utf-8-unix)

;; 耗时：1.1 s。
(when (version< emacs-version "27.0")
  (package-initialize))

;; 键绑定，耗时：0.2 s。
(load "~/.emacs.d/.init/my-key-bindings")

;; MS-Windows相关设置，耗时：0.1 s。
(when (string-equal system-type "windows-nt")
  (load "~/.emacs.d/.init/common-win"))

;; 一般的设置，耗时：0.4 s。
(load "~/.emacs.d/.init/common-settings")

;; keyboard macros
(load "~/.emacs.d/.init/.kmacros")

;; 一些函数及键绑定，耗时：0.1 s。
(load "~/.emacs.d/.init/some-functions")

;; 补全的设置，耗时：0.1 s。
(when (fboundp 'auto-complete)
  (load "~/.emacs.d/.init/auto-complete-settings"))

;; C语言编程，耗时：0 s。
(load "~/.emacs.d/.init/for-C-language")

;; (load "~/.emacs.d/.init/for-org-mode")

;; (load-theme 'my-wheatgrass t)

;; test
;; (load "~/.emacs.d/.init/test")

;; (load "~/.emacs.d/paradox-token.el")

(require 'doom-themes)

;; Global settings (defaults)
;; (setq doom-themes-enable-bold t    ; if nil, bold is universally disabled
;;       doom-themes-enable-italic t) ; if nil, italics is universally disabled

;; (assq-delete-all 'diredp-dir-name doom-themes-common-faces)
;; (setf (cdr (assq 'diredp-dir-name doom-themes-common-faces)) '(:foreground functions :weight 'bold))

;; (doom-themes--apply-faces doom-themes-common-faces)

;; Load the theme (doom-one, doom-molokai, etc); keep in mind that each theme
;; may have their own settings.

;; (load-theme 'doom-Iosvkem t)

;; (doom-themes-set-faces 'doom-Iosvkem '(diredp-dir-name :inherit font-lock-function-name-face))

;; Enable flashing mode-line on errors
;; (doom-themes-visual-bell-config)

(when (or (display-graphic-p) (daemonp))
  (when (and (require 'alpha) (featurep 'alpha))
    (transparency-set-value 95))
  ;; 字体设置
  (load "~/.emacs.d/.init/font-settings"))

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(diredp-dir-name ((t (:foreground "#81a2be"))))
 '(diredp-omit-file-name ((t (:inherit diredp-ignored-file-name))))
 '(markdown-code-face ((t (:inherit default :background "#0ccc0ccc0ccc"))))
 '(nobreak-space ((t (:inherit escape-glyph :underline t))))
 '(variable-pitch ((t (:family "Calibri Light")))))

(put 'narrow-to-region 'disabled nil)
(put 'dired-find-alternate-file 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'timer-list 'disabled nil)
(put 'downcase-region 'disabled nil)

;; Use a hook so the message doesn't get clobbered by other messages.
(add-hook 'emacs-startup-hook
          (lambda ()
	    (load-theme 'doom-tomorrow-night t)
            (message "Emacs ready in %s with %d garbage collections."
                     (format "%.2f seconds"
                             (float-time
                              (time-subtract after-init-time before-init-time)))
                     gcs-done)))

(require 'gcmh)
(gcmh-mode 1)
